package com.gnerv.rabbitmq.agent.controller;

import com.gnerv.rabbitmq.agent.business.ClusterBusiness;
import com.gnerv.rabbitmq.agent.common.model.Result;
import com.gnerv.rabbitmq.agent.model.dto.ClusterDTO;
import com.gnerv.rabbitmq.agent.model.entity.NodeStatus;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Gnerv LiGen
 */
@Slf4j
@RestController
@RequestMapping("api/rabbitmq/cluster")
public class ClusterController {

    @Resource
    private ClusterBusiness clusterBusiness;

    @GetMapping
    public Result<ClusterDTO> queryCluster(String clusterName){
        return Result.ok();
    }

    @GetMapping("node/list")
    public Result<List<NodeStatus>> listNode(String clusterName) {
        List<NodeStatus> listNode = clusterBusiness.listNode(clusterName);
        return Result.ok().data(listNode);
    }


}
